<?php

class Mod_login extends Model {

    function Mod_login() {
        parent::Model();
    }
    
//==============function check login and query data from tbl_user=============//
    
    function use_login($username, $password) {
     // echo md5($this->input->post('txtpassword'));die();
        $this->db->select('*');
        $this->db->from('tbl_user');
        $this->db->where('use_username', $username);
        $this->db->where('use_password',md5($password));
        $this->db->where('use_status', 1);
        $login = $this->db->get();
        if ($login->num_rows() > 0) {
            foreach ($login->result() as $use_row) {
                $this->session->set_userdata('use_username', $use_row->use_username);
                $this->session->set_userdata('user_type', $use_row->user_type);
            }
            return true;
        }
        else
            return false;
    }
//===============this is the end of function of user================//
}